package com.iyundao.io.controller;

import com.iyundao.io.common.ueditor.ActionEnter;
import org.json.JSONException;
import org.springframework.web.bind.annotation.*;


import javax.servlet.http.HttpServletRequest;
import java.io.*;


/**
 * 用于处理关于ueditor插件相关的请求
 */
@RestController
@CrossOrigin
@RequestMapping("/sys/ueditor")
public class UeditorController{
    @RequestMapping(value = "/exec")
    @ResponseBody
    public String exec(HttpServletRequest request) throws UnsupportedEncodingException, JSONException {
        request.setCharacterEncoding("utf-8");
        String rootPath = request.getRealPath("/");
        System.out.println(rootPath);
        return new ActionEnter(request,rootPath).exec();
    }

}
